package com.bigcms.mapper;

import com.bigcms.domain.Type;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 文章类型类
 */
@Component
public interface ArtTypeMapper {
    /**
     * 添加分类
     */
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("INSERT INTO `bc_type` ( `name`, `icon`, `create_time`, `sort`, `num`,`uid`) VALUES ( #{name}, #{icon}, #{createTime},#{sort},#{num},#{uid})")
    int addType(Type type);
    /**
     * 修改分类
     */

    int editType(Type type);
    /**
     * 查询单条分类
     */
    @Select("select * from bc_type where id=#{id}")
    Type listType(@Param("id")int id);
    /**
     * 查询多条分类
     */
    @Select("select * from bc_type order by sort desc")
    List<Type> listTypes();
    /**
     * 删除指定分类
     */
    @Delete("DELETE FROM bc_type WHERE id=#{id}")
    int delType(@Param("id")int id);

}


